package com.amor.utils;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;


public class LogUtil {
    /**
     * false不打印日志 true打印日志
     **/
    public static boolean myDebug = true;
    private static Toast toast;

    public static void logI(String TAG, String Message) {
        if (myDebug) {
            Log.i(TAG, Message);
        }
    }

    public static void logE(String TAG, String Message) {
        if (myDebug) {
            Log.e(TAG, Message);
        }
    }

    public static void logD(String TAG, String Message) {
        if (myDebug) {
            Log.d(TAG, Message);
        }
    }

    public static void logV(String TAG, String Message) {
        if (myDebug) {
            Log.v(TAG, Message);
        }
    }

    public static void logW(String TAG, String Message) {
        if (myDebug) {
            Log.w(TAG, Message);
        }
    }

    public static void Toastshow(Context context, String msg) {
        if (!TextUtils.isEmpty(msg)) {
            if (toast == null) {
                toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
            } else {
                toast.setText(msg);
            }
            toast.show();
        }
    }
}